package com.zhs.gccs.mapbox;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;

import com.zhs.gccs.R;

import java.util.ArrayList;
import java.util.List;

public class MapImageUtils {
    public static final String image_user_location = "user_location";
    public static final String image_gj_start = "gj_start";
    public static final String image_gj_end = "gj_end";
    public static final String image_local_position = "local_position";
    public static final String image_nav_sc = "nav_sc";
    ///////////////////////////////////
    public static final String image_gccj_clyzjcpzl = "clyzjcpzl";
    public static final String image_gccj_gpgc = "gpgc";
    public static final String image_gccj_tjdlgc = "tjdlgc";
    public static final String image_gccj_tkzzgc = "tkzzgc";
    public static final String image_gccj_ntdltsgc = "ntdltsgc";
    public static final String image_gccj_ntfhystbh = "ntfhystbh";
    public static final String image_gccj_ntspdgc = "ntspdgc";
    /////////////////////////////////

    public static final String image_gccs = "gccs";


    public static List<String> getAllTrouble(){
        List<String> tags = new ArrayList<>();
        tags.add(MapLegend.legend_ghsj);
        tags.add(MapLegend.legend_gdly);
        tags.add(MapLegend.legend_ggyps);
        tags.add(MapLegend.legend_ntspd);
        tags.add(MapLegend.legend_ntfhysthjbh);
        tags.add(MapLegend.legend_trgl);
        tags.add(MapLegend.legend_tjdl);
        tags.add(MapLegend.legend_tdpz);
        tags.add(MapLegend.legend_tkzz);
        tags.add(MapLegend.legend_qt);
        return tags;
    }

    public static Bitmap getImage(Context context, String trouble) {
        Bitmap bitmap = null;
        int res = 0;
        switch (trouble){
            case MapLegend.legend_ghsj:
                res = R.mipmap.flag_leg_1;//res = selected?R.mipmap.flag1:R.mipmap.flag1c;
                break;
            case MapLegend.legend_gdly:
                res = R.mipmap.flag_leg_2;
                break;
            case MapLegend.legend_ggyps:
                res = R.mipmap.flag_leg_3;
                break;
            case MapLegend.legend_ntspd:
                res = R.mipmap.flag_leg_4;
                break;
            case MapLegend.legend_ntfhysthjbh:
                res = R.mipmap.flag_leg_5;
                break;
            case MapLegend.legend_trgl://土壤改良
                res = R.mipmap.flag_leg_6;
                break;
            case MapLegend.legend_tjdl:
                res = R.mipmap.flag_leg_7;
                break;
            case MapLegend.legend_tdpz://土地平整
                res = R.mipmap.tdpz;
                break;
            case MapLegend.legend_tkzz://田块整治
                res = R.mipmap.tkzz;
                break;
            case MapLegend.legend_qt:
                res = R.mipmap.flag_leg_8;
                break;
            case image_user_location:
                res = R.mipmap.location_user;
                break;
            case image_gj_start:
                res = R.mipmap.gj_start;
                break;
            case image_gj_end:
                res = R.mipmap.gj_end;
                break;
            case image_local_position:
                res = R.mipmap.local_position;
                break;
            case image_nav_sc:
                res = R.mipmap.icon_map_nav;
                break;
            //工程抽检
            case image_gccj_clyzjcpzl:
                res = R.mipmap.cailiao_1;
                break;
            case image_gccj_gpgc:
                res = R.mipmap.guangai_1;
                break;
            case image_gccj_tjdlgc:
                res = R.mipmap.daolu_1;
                break;
            case image_gccj_tkzzgc:
                res = R.mipmap.tiankuai_1;
                break;
            case image_gccj_ntdltsgc:
                res = R.mipmap.dili_1;
                break;
            case image_gccj_ntfhystbh:
                res = R.mipmap.fanghu_1;
                break;
            case image_gccj_ntspdgc:
                res = R.mipmap.dianli_1;
                break;
            case image_gccs:
                res = R.mipmap.tiankuai_1;
                break;
        }
        BitmapDrawable drawable = (BitmapDrawable) context.getResources().getDrawable(res);
        return drawable.getBitmap();
    }

    public static String getImageId(String trouble) {
        String imageId = "legend_ghsj";
        switch (trouble){
            case MapLegend.legend_ghsj:
                imageId = "legend_ghsj";
                break;
            case MapLegend.legend_gdly:
                imageId = "legend_gdly";
                break;
            case MapLegend.legend_ggyps:
                imageId = "legend_ggyps";
                break;
            case MapLegend.legend_trgl:
                imageId = "legend_trgl";
                break;
            case MapLegend.legend_ntspd:
                imageId = "legend_ntspd";
                break;
            case MapLegend.legend_ntfhysthjbh:
                imageId = "legend_ntfhysthjbh";
                break;
            case MapLegend.legend_tjdl:
                imageId = "legend_tjdl";
                break;
            case MapLegend.legend_tdpz:
                imageId = "legend_tdpz";
                break;
            case MapLegend.legend_tkzz:
                imageId = "legend_tkzz";
                break;
            case MapLegend.legend_qt:
                imageId = "legend_qt";
                break;
        }
        return imageId;
    }

    public static int getGccjImage(String dictCode, boolean selected) {
        int res = 0;
        switch (dictCode){
            //工程抽检
            case image_gccj_clyzjcpzl://—材料与中间产品质量检验标准
                res = selected?R.mipmap.flag1:R.mipmap.flag1c;
                break;
            case image_gccj_gpgc://—灌排工程检测标准
                res = selected?R.mipmap.flag3:R.mipmap.flag3c;
                break;
            case image_gccj_tjdlgc://田间道路工程检测标准
                res = selected?R.mipmap.flag5:R.mipmap.flag5c;
                break;
            case image_gccj_tkzzgc://田块整治工程检测标准
                res = selected?R.mipmap.flag2:R.mipmap.flag2c;
                break;
            case image_gccj_ntdltsgc://农田地力提升工程检测标准
                res = selected?R.mipmap.flag6:R.mipmap.flag6c;
                break;
            case image_gccj_ntfhystbh://—农田防护与生态保护工程检测标准

                res = selected?R.mipmap.flag4:R.mipmap.flag4c;
                break;
            case image_gccj_ntspdgc://农田输配电工程检测标准
                res = selected?R.mipmap.flag7:R.mipmap.flag7c;
                break;
        }
        return res;
    }

    public static int getGccjLevelOneImage(String dictCode, boolean selected) {
        int res = 0;
        switch (dictCode){
            //工程抽检
            case image_gccj_clyzjcpzl://材料与中间产品质量检验标准
                res = selected?R.mipmap.cailiao_hover_icon:R.mipmap.cailiao_icon;
                break;
            case image_gccj_gpgc://灌排工程检测标准
                res = selected?R.mipmap.guangai_hover_icon:R.mipmap.guangai_icon;
                break;
            case image_gccj_tjdlgc://田间道路工程检测标准
                res = selected?R.mipmap.daolu_hover_icon:R.mipmap.daolu_icon;
                break;
            case image_gccj_tkzzgc://田块整治工程检测标准
                res = selected?R.mipmap.ttiankuai_hover_icon:R.mipmap.ttiankuai_icon;
                break;
            case image_gccj_ntdltsgc://农田地力提升工程检测标准
                res = selected?R.mipmap.dili_hover_icon:R.mipmap.dili_icon;
                break;
            case image_gccj_ntfhystbh://—农田防护与生态保护工程检测标准

                res = selected?R.mipmap.fanghu_hover_icon:R.mipmap.fanghu_icon;
                break;
            case image_gccj_ntspdgc://农田输配电工程检测标准
                res = selected?R.mipmap.dianli_hover_icon:R.mipmap.dianli_icon;
                break;
        }
        return res;
    }
}
